#include "canbus/message.h"

/**
 * @namespace canbus
 * @brief canbus
 */
namespace canbus {

/**
 * @class CanMsg13
 * @brief Concrete can message that stores part of the vehicle sensor information
 */
class CanMsg13: public CanMsg {
public:
  CanMsg13():
  CanMsg(),
  v_front_right(0),
  v_front_left(0),
  v_back_right(0),
  v_back_left(0)
  {}

  CanMsg13(uint8_t* value): 
  CanMsg(value), 
  v_front_right(0),
  v_front_left(0),
  v_back_right(0),
  v_back_left(0)
  {}

  virtual ~CanMsg13() = default;

  void UpUpdateData() {
    v_front_right = sensorDataFitInv(ParseTwins(*(data_+1), *(data_+0)));
    v_back_right =  sensorDataFitInv(ParseTwins(*(data_+3), *(data_+2))); 
    v_front_left =  sensorDataFitInv(ParseTwins(*(data_+5), *(data_+4)));
    v_back_left =   sensorDataFitInv(ParseTwins(*(data_+7), *(data_+6)));
  }

  template <typename T>
  void DownUpdateData(const T& input_data) {}

  static const int32_t ID;
  static const std::string NAME;

  double v_front_right;
  double v_back_right; 
  double v_front_left; 
  double v_back_left;

  friend class CanbusHandler;
};

}